<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>

</div>
<hr>
<category title="美食" :listData="foods">
    <img src="https://s3.ax1x.com/2021/01/16/srJlq0.jpg" alt="">
</category>

<script>
    let htmlHeadingElement = document.createElement("h2");
    htmlHeadingElement.innerText = "dfdf"

    let node = htmlHeadingElement.cloneNode(true);

    let elementsByTagName1 = document.getElementsByTagName("div")[0];
    elementsByTagName1.appendChild(htmlHeadingElement)

    let elementsByTagName = document.getElementsByTagName("category")[0];
    elementsByTagName.replaceWith(node)
    console.log(elementsByTagName)
</script>
</body>
</html>